import time
import unittest

from base.get_driver import Get_Driver
from page.page_cart import Page_Cart
from page.page_login import Page_Login
from page.page_order import PageOrder


class Test_Order(unittest.TestCase):
    def setUp(self):
        self.driver = Get_Driver().get_driver()
        self.login = Page_Login(self.driver)
        # 点击登录
        self.login.page_login_button()
        self.login.page_login("13012345678", "123456", "8888")
        # 加入一个商品到购物车
        Page_Cart(self.driver).page_insert_goods()
        self.order = PageOrder(self.driver)

    def test_order(self):
        time.sleep(1)
        self.order.order_all()
        msg = self.order.page_get_text()
        self.assertIn("提交成功", msg)

    def tearDown(self):
        Get_Driver().quit_driver()
